package com.foxitcloud.webpdf.calldll;

public class FXPDFFormMgr {
	private long handle = 0;
	
	public FXPDFFormMgr(String fontPath)
	{
		this.handle =  createPDFFormMgr(fontPath);
	}
	
	protected void finalize() {
		release();
	}
	
	public void release()
	{
		Na_release(this.handle);
		this.handle = 0;
	}
	
	private static long createPDFFormMgr(String fontPath)
	{
		return Na_createPDFFormMgr(fontPath);
	}
	
	public FXPDFFormHandle createPDFFormHandler()
	{
		long formHandle = Na_createPDFFormHandler(this.handle);
		if(formHandle ==0)
			return null;
		return new FXPDFFormHandle(formHandle);
	}
	
	public FXPDFFormHandle createPDFFormHandlerEx(long docHandle)
	{
		long formHandle = Na_createPDFFormHandlerEx(this.handle,docHandle);
		if(formHandle ==0)
			return null;
		return new FXPDFFormHandle(formHandle);
	}
	
	protected final static native long Na_createPDFFormMgr(String fontPath);
	protected native long Na_createPDFFormHandler(long mgrHandle);
	protected native long Na_createPDFFormHandlerEx(long mgrHandle,long doccHandle);
	protected native void Na_release(long handle);
}
